package com.msb.mall.mallsearch.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置类
 */
@Configuration
public class MallElasticSearchConfiguration {
    @Bean
    public RestHighLevelClient restHighLevelClient(){
        RestClientBuilder builder = RestClient.builder(new HttpHost("mall-node", 9200, "http"));
        RestHighLevelClient restHighLevelClient =new RestHighLevelClient(builder);
        return  restHighLevelClient;
    }

}
